Loading...
 

Interrupt InstantView® interpreter interactively

Interrupt InstantView® interpreter interactively

Continuous execution of InstantView® instructions by the InstantView® interpreter can be interrupted (and cancelled). This enables the user to end an erroneously started activity prematurely.

With the EnterKeyInterrupt function of the system object, a key combination and a message are logged on, optionally a receiver of the message (module or window object) can also be specified.

Note: Only if the InstantView® interpreter is currently executing InstantView® code will the ClassiX® system respond to the entry of these keys in this case. If you want to register a message for a key combination in general instead, the hotkey manager is the right choice.

The currently running command is still terminated, then SendMsg(...) or SendMsg(..., DIRECT) and Waitoninput are implicitlyexecuted. A running transaction remains open!

In response to the message, there are two sensible options:

  • cancel, and processing is cancelled (including aborting a transaction)
  • FinishInput, and processing continues as if there had been no interruption.

Attention: Currently, FinishInput cannot be executed directly in the message handler of the interrupt, as the corresponding WaitOnInput is only started after its execution. FinishInput must currently be triggered either from a separately opened window or via PostMsg .

The constants ESC, ALT, SHIFT, CTRL, F2, F3, ..., F12 can be used as codes for keys.
For all other keys, enter the code as a decimal or hexadecimal number.

Note on syntax: F2 ... F12 are recognised as event or constant depending on the context:

Widget(... [ F3: // Event F3 F3 // die Konstante F3 . . . ]

Caution: If it is left to the user to decide whether to continue or cancel, a time-out interval should be programmed using a CX_TIMED_TRIGGER object. Otherwise a transaction that remains open for a long time can lead to locking conflicts!

Program example:

Module(TestKeyInterrupt) [ Var(count) Msg(ALFA, BETA, GAMMA) Define(DoSomething) -> count do FindAll(CX_PERSON) iterate { String count String(" (%d)") + PutValue(win) } Decr(count) count ifnot break loop; ALFA: BETA: GAMMA: OpenWindow(itWin, 1) INITIALIZE: [ ESC ] (ALFA) NULL SystemObject Call(EnterKeyInterrupt) [ ALT 0x31 ] (BETA) NULL SystemObject Call(EnterKeyInterrupt) [ SHIFT CTRL 0x20 ] (GAMMA) NULL SystemObject Call(EnterKeyInterrupt) ] Window(win, 23, 23, 1000, 100, "Test Key Interrupt") { Button(b, BLUE, 33, 70, 120, 7, "push me") [ SELECT: 1000 DoSomething // start processing ] Attach(b, BOTTOM, 11) } Window(itWin, 1023, 23, 335, 50, "...") [ ALFA: "ESCAPE ..." PutValue BETA: "ALT 1 ..." PutValue GAMMA: "SHIFT CTRL SPACE ..." PutValue ] { Button(b1, GREEN, DEFAULT, 15, 23, 100, 7, "continue") [ SELECT: CloseWindow FinishInput // to continue ] Button(b2, RED, 210, 23, 100, 7, "cancel") [ SELECT: CloseWindow cancel // abort processing immediately ] }